<?php

namespace app\shop31\model;
use \think\facade\Db;
use think\Model;

class Category  extends Model
{
    public static function getCategory()
    {
        $list=Category:: where('parentid',0)
            ->select();
        $list=$list->toArray();

        foreach ($list as &$v){
            $v['next'] = Db::name('category')->where('parentid',$v['id'])->select()->toArray();
        }
        return $list;
    }
}